<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 水壶问题 -->
    <script>
      var canMeasureWater = function (x, y, z) {
        if (z > x + y || z < 0) return false
        if (z === 0) return true
        if (x === 0 || y === 0) return x + y === z
        const gcd = (a, b) => {
          if (b === 0) return a
          return gcd(b, a % b)
        }
        return z % gcd(x, y) === 0
      }
      console.log(canMeasureWater(3, 5, 4))
    </script>
  </body>
</html>
